﻿@model CurrencySelectorModel

@inject Nop.Core.IWebHelper webHelper

@if (Model.AvailableCurrencies.Count > 1)
{
    <div class="currency-selector">
        @{
            var returnUrl = webHelper.GetRawUrl(Context.Request);
            var currencies = Model.AvailableCurrencies.Select(x => new SelectListItem
            {
                Text = x.Name,
                Value = Url.RouteUrl("ChangeCurrency", new { customercurrency = x.Id, returnUrl }, webHelper.CurrentRequestProtocol),
                Selected = x.Id.Equals(Model.CurrentCurrencyId)
            });
            <select id="customerCurrency" name="customerCurrency" asp-items="@currencies" onchange="setLocation(this.value);" aria-label="@T("Currency.Selector.Label")"></select>
        }
    </div>
}